<%@ include file="common.jsp"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>后台登录</title>
<style type="text/css">
.bg {
	width: 100%;
	height: 100%;
	position: absolute;
	background: url(../images/background_login.jpg);
	background-attachment: fixed;
	background-repeat: no-repeat;
	background-size: cover;
	-moz-background-size: cover;
	-webkit-background-size: cover;
}

.form {
	top: 50%;
	left: 50%;
	width: 500px;
	height: 280px;
	position: absolute;
	margin: -140px 0 0 -250px;
}

.form .row {
	padding: 15px 35px 15px 15px;
}

.form .row input {
	width: 100%;
	padding: 10px; color : #a3a3a3;
	font-size: 18px;
	color: #a3a3a3;
}

.form .btn {
	color: #fff;
	right: 11px;
	width: 150px;
	height: 50px;
	bottom: 70px;
	cursor: pointer;
	font-size: 20px;
	line-height: 50px;
	position: absolute;
	text-align: center;
	background-color: #d73240;
}
</style>
</head>
<body>
	<div class="bg">
		<div class="form">
			<div class="login">
				<div class="row">
					<input type="text" name="username" placeholder="用户名">
				</div>
				<div class="row">
					<input type="password" name="password" placeholder="密码">
				</div>
				<a class="btn" onclick="login()">登 录</a>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">
	var $username = $('input[name="username"]');
	var $password = $('input[name="password"]');

	function login() {
		var url = BaseUrl + 'userAction/login.action';
		var option = {};
		option['username'] = $username.val();
		option['password'] = $password.val();

		$.a(url, option, function(res) {
			if (res.result) {
				sessionStorage.user = "admin";
				location.href = 'index.jsp';
			} else {
				layer.msg(res.message);
			}
		}, false);
	}

	$password.keyup(function(evnet) {
		if (evnet.keyCode == '13') {
			login();
		}
	});
</script>
</html>